<?php
$server = "localhost";
$uname = "root";
$umm = "root";
$db = "maxik";
$con = mysqli_connect($server, $uname, $umm, $db);
$ll = "select * from table2";
$kaldi = mysqli_query($con, $ll);



$yax="select avg (age)from table2 ";
$k_yax=mysqli_query($con, $yax);
$kur = mysqli_fetch_assoc($k_yax);
$pp= implode(',',$kur);


$jin="select count(sex) from table2 where sex=2";
$k_jin=mysqli_query($con, $jin);
$kur_jin = mysqli_fetch_assoc($k_jin);
$kur_jin_pp= implode(',',$kur_jin);



$jin1="select count(sex) from table2 where sex=1";
$k_jin1=mysqli_query($con, $jin1);
$kur_jin1 = mysqli_fetch_assoc($k_jin1);
$kur_jin_pp1= implode(',',$kur_jin1);



?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    *{font-family: "ALKATIP Basma Tom"}
</style>
<body>

<table border="1" cellpadding="25" cellspacing="0">
    <tr>
        <th>   ئوتتۇرچە ياش <?php echo($pp );?><br></th>
        <th> <?php echo($kur_jin_pp1);?>   ئوغۇللار سانى
            <br>
            <?php echo($kur_jin_pp );?>   قىزلار سانى
        </th>
        <th></th>
        <th></th>
    </tr>
</table>
<table border="1" cellpadding="20" cellspacing="0">


    <tr>
        <th>id</th>
        <th>isme</th>
        <th>yax</th>
        <th>TEL</th>
        <th>adiris</th>
        <th>jinsi</th>
        <th>kaspi</th>
        <th>kizkix</th>
        <th>时间</th>
        <th>时间1</th>
        <th>编辑</th>
        <th>删除</th>
    </tr>

    <?php


    while ($kur = mysqli_fetch_assoc($kaldi)) {
        $id = $kur['id'];
        echo "<tr>";
        echo "<td>" . $kur['id']. "</td>";
        echo "<td>" . $kur['isim'] . "</td>";
        echo "<td>" . $kur['age'] . "</td>";
        echo "<td>" . $kur['til'] . "</td>";
        echo "<td>" . $kur['ads'] . "</td>";
        if ($kur['sex'] == 2) { echo "<td>" . 'قىز' . "</td>"; } else {echo "<td>" . 'ئوغۇل' . "</td>"; }
        if ($kur['kaspi'] == 1) {
            echo "<td>" . 'HTML' . "</td>";
        } else if($kur['kaspi'] == 2) {
            echo "<td>" . 'CSS' . "</td>";
        }else if($kur['kaspi'] == 3) {
            echo "<td>" . 'PHP' . "</td>";
        }else if($kur['kaspi'] == 4) {
            echo "<td>" . 'JAVA_scrpit' . "</td>";
        }else if($kur['kaspi'] == 5) {
            echo "<td>" . '小程序' . "</td>";
        }
        echo "<td>";
        $arr = explode(";",$kur['kizkix']);

        if(in_array(1,$arr)) echo "oyun,";
        if(in_array(2,$arr)) echo "top,";
        if(in_array(3,$arr)) echo "kitap,";
        if(in_array(4,$arr)) echo "汉语";
        echo "</td>";
        echo "<td>" . $kur['created'] . "</td>";
        echo "<td>" . $kur['updated'] . "</td>";
        echo "<td> <a href='03.php?id=$id'> 编辑 </a></td>";
        echo "<td> <a href='del.php?id=$id'> 删除 </a></td>";
        echo "</tr> ";

    } mysqli_close($con);





    ?>
</table>

</body>

</html>